﻿using System;
using System.Collections.Generic;

namespace RexToy.Cassandra
{
    class SuperColumn<C, SUB> : ISuperColumn<C, SUB>
    {
        internal SuperColumn(C name, IColumnCollection<SUB> collection)
        {
            name.ThrowIfNullArgument("name");
            collection.ThrowIfNullArgument("collection");

            _name = name;
            _collection = collection;
        }

        private IColumnCollection<SUB> _collection;
        public IColumnCollection<SUB> Columns
        {
            get { return _collection; }
        }

        public ColumnType ColumnType
        {
            get { return ColumnType.Super; }
        }

        private C _name;
        public C Name
        {
            get { return _name; }
        }

        public object Value
        {
            get
            {
                throw ExceptionHelper.CreateAccessValueOfSuperColumn();
            }
        }


        public IColumn<SUB> this[SUB name]
        {
            get
            {
                return _collection[name];
            }
        }
    }
}
